﻿/***********************************************************************
 * <copyright file="DbOptionsPresenter.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   ThangND
 * Email:    thangnd@buca.vn
 * Website:
 * Create Date: 14 March 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System.Collections.Generic;
using WindowsForms.AOnline.Model.BusinessObjects.Dictionary;
using WindowsForms.AOnline.View.Dictionary;
using WindowsForms.AOnline.Presenter;
using WindowsForms.AOnline.View.Dictionary;
using WindowsForms.AOnline.View.Dictionary;


namespace WindowsForms.AOnline.Presenter.Dictionary.DbOption
{
    /// <summary>
    /// DbOptionsPresenter
    /// </summary>
    public class DbOptionsPresenter : Presenter<IDBOptionsView>
    {
        /// <summary>
        /// DbOptionts the presenter.
        /// </summary>
        /// <param name="view">The view.</param>
        public DbOptionsPresenter(IDBOptionsView view)
            : base(view)
        {
        }

        /// <summary>
        /// Displays this instance.
        /// </summary>
        public void Display()
        {
            View.DBOptions = Model.GetDbOptions();
        }

        /// <summary>
        /// Displays the is numeric.
        /// </summary>
        //public void DisplayIsNumeric()
        //{
        //    View.DBOptions = Model.GetDbOptionsIsNumeric();
        //}

        /// <summary>
        /// Displays the is string.
        /// </summary>
        //public void DisplayIsString()
        //{
        //    View.DBOptions = Model.GetDbOptionsIsString();
        //}

        /// <summary>
        /// Saves this instance.
        /// </summary>
        /// <returns></returns>
        public string Save()
        {
            var dbOptionModels = View.DBOptions;
            if (Model != null) return Model.UpdateDbOption((List<DbOptionModel>)dbOptionModels);
            return null;
        }
    }
}
